set(jpeg_directory jpeg-6b)

if(CMAKEPORTS_ASSEMBLE)
    # This section is used only in CMakePorts SVN
    set(jpeg_directory ${jpeg_directory} PARENT_SCOPE)
    set(jpeg_tarball   jpegsrc.v6b.tar.gz PARENT_SCOPE)
    set(jpeg_url http://www.ijg.org/files/jpegsrc.v6b.tar.gz PARENT_SCOPE)
    set(jpeg_patches
        jerror_missing_stdlib_h.diff
        jpeg-6b_cmp.diff
        PARENT_SCOPE)
endif()

if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${jpeg_directory}")
    add_subdirectory(${jpeg_directory})
endif()

# Compatibility settings for interoperability with FindJPEG.cmake
set(JPEG_FOUND 1 CACHE INTERNAL "Found JPEG")
set(JPEG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${jpeg_directory} CACHE INTERNAL "JPEG include dir")
set(JPEG_LIBRARY   jpeg CACHE INTERNAL "JPEG library")
set(JPEG_LIBRARIES jpeg CACHE INTERNAL "JPEG libraries")
set(NATIVE_JPEG_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${jpeg_directory} CACHE INTERNAL "deprecated")
